In this assignment, you will:
install the main programs we will use in the course
create your own GitHub account and start a “repository” that is available for everyone to see
learn to “commit” and “push” changes on your local computer to your online GitHub repository
Use the following link to download R for your particular computer system: https://cran.r-project.org/
It’s a good idea to install R before installing R-Studio https://www.rstudio.com/products/rstudio/download/#download
Here’s the download page: https://git-scm.com/downloads
If you are on a Windows computer, click the “Windows” button and your download should start automatically. Run the .exe file to install “Git Bash”
If you are on a Mac, click the “Mac” button and the .dmg file should download automatically. This will open in your software center and install.
If you are on Linux, here are the instructions, depending on your version: https://git-scm.com/download/linux
Once you have Git installed, open it up (in Windows this will be a shortcut called “Git Bash”, in Mac or Linux, just open your terminal -that scary command prompt- and it will be working in the background) You will see a simple command line interface that looks something like this:
Navigate to your computer Desktop using the command-line. If you’ve never done this before, here’s a nice introduction: https://computers.tutsplus.com/tutorials/navigating-the-terminal-a-gentle-introduction--mac-3855
Basically, you can enter commands to move into or out of directories and look at what files are present.
Here’s an example output from those first two commands:
ls #this lists files in my current directory
## Assignment_1.html
## Assignment_1.pdf
## Assignment_1.rmd
## setup_git_credential_helper.R
pwd #this tells me what my current directory is
## /home/gzahn/Desktop/GIT_REPOSITORIES/gzahn.github.io/data-course/Repository/Assignments/Assignment_1
The “cd” command requires a bit more. You have to tell it what directory to change to…
Mac and Linux users can probably just type “cd ~/Desktop” and they will instantly be on their Desktop folder Windows file paths are a bit different, but it’s probably something like this:
cd C:\Users\YOUR_NAME\Desktop
Once you’re in your Desktop folder (you can check with “pwd”) copy and paste the following into your terminal:
git clone https://github.com/gzahn/Data_Course.git
This will download a folder onto your computer. It will be found wherever you were when you entered the previous command….so hopefully your Desktop.
If you have it, that means you successfully “cloned” my online repository onto your local computer. This “git clone WHATEVER_WEBSITE_ADDRESS” will be very useful to you in this class. It’s how you will access other materials from my GitHub repositories, including exams!
That takes care of the software installation and course materials. Now, you need to set up your own GitHub account online.
This GitHub account is a way for you to store version-controlled code, data, and even your personal website that you will build by the end of the semester. It’s something that you can put on your CV/Resume to demonstrate coding and data analysis ability. Save your password someplace safe. Don’t give it to anyone, including me.
I made a short video walkthrough of the following steps here: https://youtu.be/M9430_eGttI
See these instructions for setting up 2-factor authentication for RStudio.
Enable two-factor authentication
Use the LastPass App for your phone, give it your phone number as a backup, and save your account recovery codes somewhere very safe (gmail draft message?)
You will need to create a personal access token to use GitHub from the command line
Copy your token and paste it into a text document. To set it as an “environment variable” enter the following in your command-line terminal, replacing TOKEN with the actual token you received online and YOUR_GITHUB_USERNAME with your username (keep all quotes as-is):
echo 'export GIT_PASSWORD="TOKEN"' >> ~/.bashrc
echo 'export GIT_USERNAME="YOUR_GITHUB_USERNAME"' >> ~/.bashrc
exec bash
You can now type the following to see/copy your command-line GitHub token:
echo $GIT_PASSWORD
To get these to be automatically entered when you use git from the command-line or Rstudio, check out this website
You will have to add the file that you create with those instructions to the git config for each new repository.
In your terminal, navigate to your Desktop with the command-line again
Now clone the github page you created (The one called Data_Course_YOURLASTNAME)
Navigate into this new repository (The one called Data_Course_YOURLASTNAME) and type the following commands in order:
(actually, copy-paste is better than typing. Coders use CTRL-C / CTRL-V more than anything else!)
(What?! It’s not pasting text into your terminal? Ah, use CTRL-SHIFT-V or SHIFT-INS to paste into your terminal!)
echo "This README file contains information about my uploaded assignments" >> README.md
git add README.md
git commit -m "1st commit"
git push
(Here it will ask for your GitHub userID and password....enter those when asked)
This series of commands commits your changes (Adding that text to the README.md file)
and pushes the changes back onto the website version
Check back on your GitHub page online…if you see that new text (“This README file contains information about my uploaded assignments”) then you are finished!
To get credit, upload a link to your GitHub repository to “Assignment 1” in Canvas. I’ll click on that and see whether your README.md file is correct.
You now have a copy of all the current course materials along with your own personal repository This GitHub repository is where you will keep projects you’re working on, notes, examples, data sets, etc.
Warning: I will be cloning all of your repositories onto my own computer to keep track of your course work So don’t write hate mail about me in files in that directory.